package com.chf.carsystem.common.text;



import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 测试类
 * @author Administrator
 *
 */
public class BaseTest 
{

	protected ApplicationContext ac = null;
	protected Logger logger = LogManager.getLogger();
	
	
	@Before
	public void init()
	{
		//初始化 spring的配置文件
		
		ac = new ClassPathXmlApplicationContext("classpath*:spring/applicationContext-*.xml");
		logger.info("ac:{}",ac);
	}
	
	
	
	@Test
	public void test()
	{
		System.out.println("=======test()=======");
	}
	
	
	
	
	@After
	public void closed()
	{
		if(ac instanceof ClassPathXmlApplicationContext)
		{
			//强转
			ClassPathXmlApplicationContext apxac = (ClassPathXmlApplicationContext)ac;
			apxac.close();
			System.out.println("=======closed()=======");
		}
	}
	
	
	
	
}
